﻿using MediatR;
using W.Warehouse.Domain.AllocationProduct;
using W.Warehouse.Read.Api.Application.Command.AllocationCommand;
using W.Warehouse.Repository.Interface;

namespace W.Warehouse.Read.Api.Application.CommandHandlder.AllocationCommandHandler
{
    public class AllocationModelCommandHandler:IRequestHandler<AllocationModelCommand,Allocation>
    {
        private readonly IAllocationRepository _iallocationRepository;
        public AllocationModelCommandHandler(IAllocationRepository iallocationRepository)
        {
            _iallocationRepository = iallocationRepository;
        }

        public async Task<Allocation> Handle(AllocationModelCommand request, CancellationToken cancellationToken)
        {
           return  await _iallocationRepository.GetModelAsync(request.AllocationId);
        }
    }
}
